package ca.magex.database;

import java.sql.DriverManager;

import com.mysql.jdbc.Connection;

public class MySQLDatabaseManager implements DatabaseManager {

	MySQLDatabaseManager() { };
	
	private static DatabaseManager instance;
	
	public static DatabaseManager getInstance() {
		if (instance == null) 
			instance = new MySQLDatabaseManager();
		return instance;
	}
	
	public Connection getConnection() {
		try {
	        Class.forName("com.mysql.jdbc.Driver").newInstance();
	        Connection conn = (com.mysql.jdbc.Connection)DriverManager.getConnection(
	        		"jdbc:mysql://localhost/tagger?user=tagger&password=tagger");
	        return conn;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	
}
